﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ParseAndPopulate
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            label5.Text = "Whenever you're ready..";
            radioButton1.Checked = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string address = textBox1.Text;
            string user = textBox2.Text;
            string passwd = textBox3.Text;
            string dbName = textBox6.Text;
            string year = maskedTextBox1.Text;
            string table = textBox4.Text;
            string seas = "4";
            if (radioButton1.Checked == true)
                seas = "2";

         
            //test values
            address = "108.175.158.161";
            user = "soen341user";
            passwd = "softwareprocess";
            dbName = "soen341dB";
            table = "Course_Object3";

            //


            WebScraper final = new WebScraper();
            label5.Text = "Working...";
            final.SendToDB(address, user, passwd, dbName, year, seas, table);
            label5.Text = "Done";
        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            string address = textBox1.Text;
            string user = textBox2.Text;
            string passwd = textBox3.Text;
            string dbName = textBox6.Text;

            //test values
            address = "108.175.158.161";
            user = "soen341user";
            passwd = "softwareprocess";
            dbName = "soen341dB";
            WebScraper t = new WebScraper();
            List<string> a = new List<string>();
            a.Add("ELEC 273");
            //a.Add("ELEC 364");
            a.Add("ELEC 311");

            t.generate(address, user, passwd, dbName,a);
            
            
            

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }
    }
}
